package com.qf.fmall01.utils;

import java.util.Base64;

public class Base64Utils {

    //加密
    public static String encode(String msg){
        return Base64.getEncoder().encodeToString(msg.getBytes());
    }
    //解密
    public static String decode(String msg){
        return new String(Base64.getDecoder().decode(msg));
    }

    public static void main(String[] args) {
        String s = "hello world!";
        String encode = Base64Utils.encode(s);
        System.out.println(encode);
        String decode = Base64Utils.decode(encode);
        System.out.println(decode);
    }

}
